cmake_minimum_required(VERSION 3.5) # CMake install : https://cmake.org/download/
project(demo LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories("./lib/ffmpeg/include")          # 引入外部头文件
link_directories(${CMAKE_SOURCE_DIR}/lib/ffmpeg/lib) # 引入动态链接库

#设置输出路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)

find_package(Qt5 COMPONENTS Core Network Widgets Multimedia REQUIRED) # Qt COMPONENTS

# Specify MSVC UTF-8 encoding   
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

aux_source_directory(./src SRCS)

add_executable(${PROJECT_NAME}
    # WIN32 # If you need a terminal for debug, please comment this statement 
    ${SRCS}
)

target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Core Qt5::Network Qt5::Multimedia) # Qt5 Shared Library
target_link_libraries(${PROJECT_NAME} -Wl,--start-group avcodec avformat avutil swresample swscale -Wl,--end-group) # FFmpeg Shared Library